package main


import (
	"fmt"
	"time"
	"strconv"
)


func test(){

	i:=0
	str:="dd"
	for ;i<10000;i++{
		str+="te"+strconv.Itoa(i)
	}
}
func main(){


	now:=time.Now()
	fmt.Printf("now=%v,now type=%T\n",now,now)

	fmt.Printf("%v\n",now.Year())
	fmt.Printf("%v\n",int(now.Month()))
	fmt.Printf("%v\n",now.Day())
	fmt.Printf("%v\n",now.Hour())
	fmt.Printf("%v\n",now.Minute())
	fmt.Printf("%v\n",now.Second())

	dateStr:=fmt.Sprintf("%d-%d-%d %d:%d:%v\n",now.Year(),
now.Month(),now.Day(),now.Hour(),now.Minute(),now.Second())
	fmt.Printf("%v\n",dateStr)

	fmt.Printf(now.Format("2006/01/02 15:04:05"))
	fmt.Println()
	fmt.Printf(now.Format("2006-01-02"))
	fmt.Println()
	fmt.Printf(now.Format("15:04:05"))

	fmt.Printf(now.Format("2006"))

	/**
	const (
    Nanosecond  Duration = 1
    Microsecond          = 1000 * Nanosecond
    Millisecond          = 1000 * Microsecond
    Second               = 1000 * Millisecond time.Millisecond=1ms
    Minute               = 60 * Second  time.Second=1秒
    Hour                 = 60 * Minute
)
	**/
	// i:=0
	// for{
	// 	i++
	// 	fmt.Println(i)
	// 	//time.Sleep(time.Second)//经过了1秒钟以后
	// 	time.Sleep(time.Millisecond*100)//0.1秒
	// }

	fmt.Println("unix=",now.Unix())
	fmt.Println("unixNano=",now.UnixNano())

	start:=time.Now().UnixNano()

	test()
	end:=time.Now().UnixNano()

	fmt.Println("end-start=",end-start)

}